﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TodoApp.ResultModel;
using Volo.Abp.Application.Services;

namespace TodoApp.TMS_SetUp.Departments
{
    public class TMS_DepartmentService: ApplicationService
    {
        private readonly ITMS_DepartmentRerepository _tMS_DepartmentRerepository;
        public TMS_DepartmentService(ITMS_DepartmentRerepository tMS_Department)
        {
            _tMS_DepartmentRerepository = tMS_Department;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="tMS_Department"></param>
        /// <returns></returns>
        public async Task<int> CreateDepartment(TMS_Department tMS_Department)
        {
            return await _tMS_DepartmentRerepository.CreateDepartment(tMS_Department);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> DeleteDepartment(string id)
        {
            return await _tMS_DepartmentRerepository.DeleteDepartment(id);
        }
        /// <summary>
        /// 显示分页
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<TMS_DepartmentDto>> GetDepartmentDto(string name, int pageindex = 1, int pagesize = 5)
        {
            return await _tMS_DepartmentRerepository.GetDepartmentDto(name, pageindex, pagesize);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="tMS_DepartmentDto"></param>
        /// <returns></returns>
        public async Task<int> UpdateDepartmentDto(TMS_DepartmentDto tMS_DepartmentDto)
        {
            return await _tMS_DepartmentRerepository.UpdateDepartmentDto(tMS_DepartmentDto);
        }
    }
}
